{extend name="index/index" /}

{block name="title"}
<title>[ Redirect ]</title>
{/block}

{block name="css"}
<style>
    body {
        background-color: #000;
        color: #fff;
    }
</style>
{/block}
{block name="main"}

<div class="container mt50 p50">
    <div class="row p20">
        <?php switch ($code) {?>
        <?php case 1:?>
        <div class="col-md-6 col-md-offset-3" style="border-radius:50%;box-shadow: -10px 10px 10px #0a0">
            <div class="system-message p50">
                <h1 class="text-center" style="font-size: 40px;color: #0a0">
                    <i class="icon icon-check icon-3x"></i>
                    Success
                </h1>
                <p class="text-center mt30" style="font-size: 20px;"><?php echo(strip_tags($msg));?></p>
                <hr>
                <p class="text-center">
                    页面自动跳转，等待时间： <b id="wait"><?php echo($wait);?></b> 秒 | 🎈
                    <a id="href" href="<?php echo($url);?>" style="color: #0a0">【 立即跳转 】</a>
                </p>
            </div>
        </div>
        <?php break;?>
        <?php case 0:?>
        <div class="col-md-6 col-md-offset-3" style="border-radius:50%;box-shadow: -10px 10px 10px #f90">
            <div class="system-message p50">
                <h1 class="text-center" style="font-size: 40px;color:#f90">
                    <i class="icon icon-times icon-3x"></i>
                    Error
                </h1>
                <p class="text-center mt30" style="font-size: 20px;"><?php echo(strip_tags($msg));?></p>
                <hr>
                <p class="text-center">
                    页面自动跳转，等待时间： <b id="wait"><?php echo($wait);?></b> 秒 | 🎈
                    <a id="href" href="<?php echo($url);?>" style="color: #f90">【 立即跳转 】</a>
                </p>
            </div>
        </div>
        <?php break;?>
        <?php } ?>
    </div>
</div>
{/block}

{block name="js"}
<script type="text/javascript">
    (function () {
        var wait = document.getElementById('wait'),
            href = document.getElementById('href').href;
        var interval = setInterval(function () {
            var time = --wait.innerHTML;
            if (time <= 0) {
                location.href = href;
                clearInterval(interval);
            }
        }, 1000);
    })();
</script>
{/block}
